package com.struct.graph.game.kit
{
	import com.component.ComponentChildren;
	
	import flash.display.Sprite;
	import flash.events.TimerEvent;
	import flash.utils.Timer;
	
	public class RedPoint extends ComponentChildren
	{
		private var timer:Timer;
		
		private var num:int;
		public function RedPoint()
		{
			super();
			width = 64;
			height = 64;
			mouseEnabled = false;
			timer = new Timer(200);
			timer.addEventListener(TimerEvent.TIMER, timerHandler);
		}
		private function timerHandler(e:TimerEvent):void{
			graphics.clear();
			graphics.beginFill(0xff0000);
			for(var i:uint = 0; i < num; ++i){
				graphics.drawRect(i * 2, i * 2, width - i * 4, height - i * 4);
				graphics.drawRect(i * 2 + 1, i * 2 + 1, width - i * 4 - 2, height - i * 4 - 2);
			}
			graphics.endFill();
			if(++num > 5){
				num = 0;
			}
		}
		public function start(x:int, y:int):void{
			timer.start();
			this.x = x;
			this.y = y;
		}
		public function stop():void{
			timer.stop();
			graphics.clear();
		}
	}
}